package ro.sergiu.finder.utils;

import ro.sergiu.finder.models.property.ComboAdapter;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

/**
 *
 * @author Toporjinschi
 */
public class ComboEnumCellRenderer extends DefaultListCellRenderer {

    public ComboEnumCellRenderer() {
    }

    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        if (value instanceof ComboAdapter) {
            setText(((ComboAdapter) value).getAsString());
        }
        return this;
    }

}
